from celery import Celery


#broker: 任务仓库
broker = 'redis://127.0.0.1:6379/5'

#backed: 任务结果仓库
backed = 'redis://127.0.0.1:6379/6'

#include: 任务(函数)所在文件
app = Celery(broker=broker,backend=backed,include=['celery_task.tasks'])

#时区
app.conf.timezone = 'Asia/Shanghai'

#是否使用UTC
app.conf.enable_utc = False

# 任务的定时配置
from datetime import timedelta
from celery.schedules import crontab
app.conf.beat_schedule = {
    'low-task':{
        'task':'celery_task.tasks.add',
        'schedule':timedelta(seconds=3),
        'args':(300,150)
    }
}